/* 
* TODO: 1. Place the .txt data file and the dictionary file you downloaded in the work folder, or enter the full path to these files!
*       2. You may have to increase memory using the 'set mem' statement. It is commented out in the code bellow.
*
* If you have any questions or need assistance contact info@socialexplorer.com.
*/

///set mem 512m
clear all
version 11
set more off
cd "C:\Users\hd233\Dropbox\Yale\Research\APEEP\data\income"
infile using "ACS2018_5yr_R12526591.dct", using("ACS2018_5yr_R12526591_SL050.txt")


destring FIPS, generate(fips)
ren A14024_001 income_2000usd
ren A00001_001 pop
keep fips income* pop
codebook income* pop

compress
saveold data_income_pop_2016_acs, replace


/*---------------------------------------------------------------------------------------------------------------------------------
income_2000usd                                   Per Capita Income (In 2000 Inflation Adjusted Dollars) [Dollars adjusted for inf
---------------------------------------------------------------------------------------------------------------------------------

                  type:  numeric (double)

                 range:  [4085.5181,49808.58]         units:  1.000e-06
         unique values:  2975                     missing .:  1/3220

                  mean:     18218
              std. dev:   4735.19

           percentiles:        10%       25%       50%       75%       90%
                           13276.2   15382.6   17844.6   20499.4   23511.2

---------------------------------------------------------------------------------------------------------------------------------
pop                                                                                                              Total Population
---------------------------------------------------------------------------------------------------------------------------------

                  type:  numeric (long)

                 range:  [75,10098052]                units:  1
         unique values:  3158                     missing .:  0/3220

                  mean:    101332
              std. dev:    326096

           percentiles:        10%       25%       50%       75%       90%
                            5199.5   11213.5   25950.5   66572.5    203877

*/
